package crossover;
import util.DebugConfig;
import util.GAConfig;
import util.Log;
import operations.ValuesGenerator;
public class SingleCrossOver extends CrossoverStrategy {

	private int crossoverPoint_1,crossoverPoint_2;
	
	@Override
	public int[] getCrossoverPoints(int individual1_Size,int individual2_Size) {
		
		this.crossoverPoint_1 = (int) Math.floor((float) individual1_Size / (float) 2);
		this.crossoverPoint_2 = (int) Math.floor((float) individual2_Size / (float) 2);
		if(DebugConfig.CrossOverClass){
				System.err.println("this.crossoverPoint_1: "+this.crossoverPoint_1 + " this.crossoverPoint_2: "+this.crossoverPoint_2);
				Log.log("this.crossoverPoint_1: "+this.crossoverPoint_1 + " this.crossoverPoint_2: "+this.crossoverPoint_2);

		}
		return new int[] { this.crossoverPoint_1,this.crossoverPoint_2 };
		
	}

	@Override
	public boolean getCrossoverFlag() {

		if(ValuesGenerator.getBoolean(GAConfig.crossover_rate))
			return true;
		else{
			if(DebugConfig.CrossOverClass){
				System.err.println("No CrossOver");
				Log.log("No CrossOver");

		}

		}
		return false;
		
	}
}
